home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / f90 / maxloc.z / maxloc
Encoding:
Text File  |  1998-10-30  |  6.3 KB  |  136 lines

  1. MAXLOC(3I)                                             Last changed: 2-5-98
  2.  
  3.  
  4. NNAAMMEE
  5.      MMAAXXLLOOCC - Returns the location of a maximum value in an array
  6.  
  7. SSYYNNOOPPSSIISS
  8.      MMAAXXLLOOCC (([AARRRRAAYY==]_a_r_r_a_y [,,[DDIIMM==]_d_i_m] [,,[MMAASSKK==]_m_a_s_k]))
  9.  
  10.      MMAAXXLLOOCC (([AARRRRAAYY==]_a_r_r_a_y [,,[MMAASSKK==]_m_a_s_k]))
  11.  
  12. IIMMPPLLEEMMEENNTTAATTIIOONN
  13.      UNICOS, UNICOS/mk, and IRIX systems
  14.  
  15. SSTTAANNDDAARRDDSS
  16.      Fortran 90
  17.  
  18. DDEESSCCRRIIPPTTIIOONN
  19.      The MMAAXXLLOOCC intrinsic function returns the location of the first
  20.      element of _a_r_r_a_y having the maximum value of the elements identified
  21.      by _m_a_s_k.  It accepts the following arguments:
  22.  
  23.      _a_r_r_a_y     Must be of type integer or real.  It must not be scalar.
  24.  
  25.      _d_i_m       Must be a scalar integer value in the range 1 <= _d_i_m <= _n,
  26.                where _n is the rank of _a_r_r_a_y.  The corresponding actual
  27.                argument must not be an optional dummy argument.  This
  28.                function does a check on _d_i_m when present.
  29.  
  30.      _m_a_s_k      Must be of type logical and must be conformable with _a_r_r_a_y.
  31.  
  32.      MMAAXXLLOOCC is a transformational function.  The name of this intrinsic
  33.      cannot be passed as an argument.
  34.  
  35. NNOOTTEESS
  36.      On UNICOS systems, both execution speed and the number of bits used in
  37.      mathematical operations are affected when compiling with
  38.      ff9900 --OO ffaassttiinntt, which is the default setting.  For more information,
  39.      see _C_F_9_0 _C_o_m_m_a_n_d_s _a_n_d _D_i_r_e_c_t_i_v_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, publication
  40.      SR-3901.
  41.  
  42. RREETTUURRNN VVAALLUUEESS
  43.      The result is an integer of type default integer, of rank one, with
  44.      size equal to the rank of _a_r_r_a_y.
  45.  
  46.      The result of MMAAXXLLOOCC((_a_r_r_a_y)) is a rank one array whose element values
  47.      are the values of the subscripts of an element of _a_r_r_a_y whose value
  48.      equals the maximum value of all of the elements of _a_r_r_a_y.  The _ith
  49.      subscript returned lies in the range 1 to _e , where _e  is
  50.                                                 _i         _i
  51.      the extent of the _ith dimension of _a_r_r_a_y.  If more than one element
  52.      has the maximum value, the element whose subscripts are returned is
  53.      the first such element, taken in array element order.  If _a_r_r_a_y has
  54.      size 0, the value of the result is undefined.
  55.  
  56.      The result of MMAAXXLLOOCC((_a_r_r_a_y,,MMAASSKK==_m_a_s_k)) is a rank one array whose
  57.      element values are the values of the subscripts of an element of
  58.      _a_r_r_a_y, corresponding to a true element of _m_a_s_k whose value equals the
  59.      maximum value of all such elements of _a_r_r_a_y.  The _ith subscript
  60.      returned lies in the range 1 to _e , where _e  is
  61.                                       _i         _i
  62.      the extent of the _ith dimension of _a_r_r_a_y.  If more than one such
  63.      element has the maximum value, the element whose subscripts are
  64.      returned is the first such element taken in array element order.  If
  65.      there are no such elements (that is, if _a_r_r_a_y has size 0 or if every
  66.      element of _m_a_s_k has the value false), the value of the result is
  67.      undefined.
  68.  
  69.      If _a_r_r_a_y has rank one, the result of
  70.      MMAAXXLLOOCC((_a_r_r_a_y,, DDIIMM==_d_i_m [,, MMAASSKK==_m_a_s_k])) is a scalar with a value that is
  71.      the same as that of the first element of MMAAXXLLOOCC((_a_r_r_a_y [,, MMAASSKK==_m_a_s_k])).
  72.      Otherwise, the value of element (_s , _s , ..., _s     , _s     , ..., _s )
  73.                                        1   2        _d_i_m-1   _d_i_m+1        _n
  74.      of the result is equal to
  75.      MMAAXXLLOOCC((_a_r_r_a_y(_s , _s , ..., _s     , : , _s     , ..., _s )),, DDIIMM==11
  76.                    1   2        _d_i_m-1       _d_i_m+1        _n
  77.      [,, MMAASSKK==_m_a_s_k(_s , _s , ..., _s     , : , _s     , ..., _s )])).
  78.                    1   2        _d_i_m-1       _d_i_m+1        _n
  79.      An element of the result is undefined if the value cannot be
  80.      represented as an integer.
  81.  
  82. EEXXAAMMPPLLEESS
  83.      Example 1:  The value of MMAAXXLLOOCC(( ((// 22,, 66,, 44,, 66 //)) )) is [2].  If array
  84.      B is declared IINNTTEEGGEERR,, DDIIMMEENNSSIIOONN((44::77)) :::: BB == ((// 88,, 66,, 33,, 11 //)), the
  85.      value of MMAAXXLLOOCC((BB)) is [1].
  86.  
  87.      Example 2:  Assume that AA is the following array:
  88.  
  89.           | 0 -5  8 -3 |
  90.  
  91.           | 3  4 -1  2 |
  92.  
  93.           | 1  5  6 -4 |
  94.  
  95.      The following are true:
  96.  
  97.           MMAAXXLLOOCC((AA)) is [1, 3]
  98.  
  99.           MMAAXXLLOOCC((AA,, MMAASSKK==AA ..LLTT.. 66)) is [3, 2]
  100.  
  101.      Using array section references, the following are true:
  102.  
  103.           MMAAXXLLOOCC((AA((22::33,,22::44)))) is [ 2, 2 ]
  104.  
  105.           MMAAXXLLOOCC((AA((22::33,,22::44)),,MMAASSKK==AA((22::33,,22::44))..LLTT..66)) is [ 2, 1 ]
  106.  
  107.      Example 3:  Assume that BB is the following array:
  108.  
  109.           [ 100, 2, 5, 7, 1, 90, 0, 20, -1, 80 ]
  110.  
  111.      The following are true of this array:
  112.  
  113.           MMAAXXLLOOCC((BB((1100::11::--11)))) is [ 10 ]
  114.  
  115.           MMAAXXLLOOCC((BB((1100::11::--22)))) is [ 3 ]
  116.  
  117.      Example 4:  The value of MMAAXXLLOOCC((((//55,,--99,,33//))DDIIMM==11)) is 1.
  118.  
  119.      Example 5:  Assume that CC is following array:
  120.  
  121.           | 1 3 -9 |
  122.  
  123.           | 2 2  6 |
  124.  
  125.      The following are true of this array:
  126.  
  127.           MMAAXXLLOOCC((CC,,DDIIMM==11)) is [ 2, 1, 2 ]
  128.  
  129.           MMAAXXLLOOCC((CC,,DDIIMM==22)) is [ 2, 3 ]
  130.  
  131.           MMAAXXLLOOCC((CC)) is [ 2, 3 ]
  132.  
  133. SSEEEE AALLSSOO
  134.      _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, publication SR-2138, for the
  135.      printed version of this man page.
  136.